/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cl.bussines.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Vogel
 */
@Entity
@Table(name = "prov_has_prod")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ProvHasProd.findAll", query = "SELECT p FROM ProvHasProd p"),
    @NamedQuery(name = "ProvHasProd.findByIdProvHasProd", query = "SELECT p FROM ProvHasProd p WHERE p.idProvHasProd = :idProvHasProd"),
    @NamedQuery(name = "ProvHasProd.findByPrecioUnit", query = "SELECT p FROM ProvHasProd p WHERE p.precioUnit = :precioUnit"),
    @NamedQuery(name = "ProvHasProd.findByPrecioFinal", query = "SELECT p FROM ProvHasProd p WHERE p.precioFinal = :precioFinal")})
public class ProvHasProd implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_Prov_Has_Prod")
    private Integer idProvHasProd;
    @Size(max = 11)
    @Column(name = "Precio_Unit")
    private String precioUnit;
    @Size(max = 11)
    @Column(name = "Precio_Final")
    private String precioFinal;
    @JoinColumn(name = "Cod_Prod_Prov", referencedColumnName = "Cod_Prod_Prov")
    @ManyToOne(optional = false)
    private ProductosProv codProdProv;
    @JoinColumn(name = "id_Prov", referencedColumnName = "id_Prov")
    @ManyToOne(optional = false)
    private Proveedores idProv;

    public ProvHasProd() {
    }

    public ProvHasProd(Integer idProvHasProd) {
        this.idProvHasProd = idProvHasProd;
    }

    public Integer getIdProvHasProd() {
        return idProvHasProd;
    }

    public void setIdProvHasProd(Integer idProvHasProd) {
        this.idProvHasProd = idProvHasProd;
    }

    public String getPrecioUnit() {
        return precioUnit;
    }

    public void setPrecioUnit(String precioUnit) {
        this.precioUnit = precioUnit;
    }

    public String getPrecioFinal() {
        return precioFinal;
    }

    public void setPrecioFinal(String precioFinal) {
        this.precioFinal = precioFinal;
    }

    public ProductosProv getCodProdProv() {
        return codProdProv;
    }

    public void setCodProdProv(ProductosProv codProdProv) {
        this.codProdProv = codProdProv;
    }

    public Proveedores getIdProv() {
        return idProv;
    }

    public void setIdProv(Proveedores idProv) {
        this.idProv = idProv;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idProvHasProd != null ? idProvHasProd.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ProvHasProd)) {
            return false;
        }
        ProvHasProd other = (ProvHasProd) object;
        if ((this.idProvHasProd == null && other.idProvHasProd != null) || (this.idProvHasProd != null && !this.idProvHasProd.equals(other.idProvHasProd))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "cl.bussines.entities.ProvHasProd[ idProvHasProd=" + idProvHasProd + " ]";
    }
    
}
